import requests
from config import url, headers_web


class Users:

    def __init__(self):
        self.url = url
        self.headers = headers_web

    @classmethod
    def get_info_by_id(cls, url: str, params=None, headers=headers_web):
        """
        @Summary:根据用户Id查询用户信息(多个用户，用“,”隔开)
        @Description:调用方：1、teachingapi
        :param url:
        :param params:
        :param headers:
        """
        url = url + "/authoritycontrolplatformapi/api/v1/users/userpartialinfos"
        r = requests.get(url=url, headers=headers, params=params)
        return r

    @classmethod
    def get_teachers_info(cls, url: str, params=None, headers=headers_web):
        """
        @Summary:获取所有教职工的信息
        @Description:期末评教获取所有教职工信息
        :param url:
        :param params:
        :param headers:
        """
        url = url + "/authoritycontrolplatformapi/api/v1/users/teachers"
        r = requests.get(url=url, headers=headers, params=params)
        return r

    @classmethod
    def get_students_info(cls, url: str, params=None, headers=headers_web):
        """
        @Summary:获取所有学生的信息
        @Description:期末评教获取学生信息
        :param url:
        :param params:
        :param headers:
        """
        url = url + "/authoritycontrolplatformapi/api/v1/users/students"
        r = requests.get(url=url, headers=headers, params=params)
        return r

    @classmethod
    def post_modify_cardNo(cls, url: str, params=None, headers=headers_web, json=None):
        """
        @Summary:修改人员卡号
        @Description:teachingService调用
        :param url:
        :param params:
        :param headers:
        :param json:
        """
        url = url + "/authoritycontrolplatformapi/api/v1/users/modifycardno"
        r = requests.post(url=url, headers=headers, params=params, json=json)
        return r
